home *** CD-ROM | disk | FTP | other *** search
- Path: wv.mentorg.com!bloom
- From: bloom@wv.mentorg.com (Scott Aron Bloom)
- Newsgroups: comp.lang.c++
- Subject: Re: cin and floats
- Date: 23 Jan 1996 00:33:48 GMT
- Organization: Mentor Graphics, Wilsonville, Oregon, USA
- Distribution: world
- Message-ID: <4e1adc$dvh@hpbab.wv>
- References: <4d9d0g$5s0@sol.zynet.net>
- NNTP-Posting-Host: glock.wv
-
- In article <4d9d0g$5s0@sol.zynet.net>, damage@nashuauk.zynet.co.uk (Damage) writes:
- |> HELP! I can't seem to use "cin" to input into floating point numbers.
- |> Whenever I enter a decimal number I just get "Floating Point
- |> Overflow". Integers are fine, it's also fine if I enter whole number
- |> into the float variable (and yes I'm positive that I've declared the
- |> variable correctly).
- |>
- |> I am using Turbo C++ 4.5 for Windows under Win '95.
- |>
- |> eg:
- |> float x;
- |>
- |> cout << "Enter Real Number: ";
- |> cin >> x;
- |>
- |> Any help would be most appreciated.
- |>
- |> Cheers. Shane.
- |> ...~daMage~...
- |>
-
-
- I have a feeling it has to do with the input mechinism in
- win 95. Having never programed in win95, but doing some
- programming in Win 3.11.
-
- Do a help search in BC++ for input and see what it has to say.
-
-
- FWIW, i tried the followin code on a UNIX system, and it worked
- without a hitch:
-
- #include <iostream.h>
-
- main()
- {
- float x;
-
- cout << "Enter Real Number: ";
- cin >> x;
-
- cout << "You entered: " << x << endl;
- }
-
-
- Scott
- --
- ----------------------------------------------------------
- Scott Aron Bloom email: bloom@wv.mentorg.com
- Mentor Graphics Corporation main: (503) 685-7000
- 8005 S.W. Boeckman Road C/4 direct: (503) 685-7996
- Wilsonville, OR 97070-7777 fax: (503) 685-1268
- =============== Silicon Systems Division ===============
- ----------------------------------------------------------
-